<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<div id="app">
			
		</div>
		<script>
			function getObjByJsonFile(filePath){
				while(true){
					if([".","/","\\"].indexOf(filePath[0])<0)
						break;
					else
						filePath=filePath.slice(1)
					console.log(filePath)
				}
				var xml=new XMLHttpRequest()
				xml.open('GET',filePath,true)
				xml.send()
				return new Promise((resolve,reject)=>{
					xml.onreadystatechange=function(e){
						if(e.target.status==200 && e.target.readyState==4){
							resolve(JSON.parse(e.target.responseText))
						}
					}
				})
			}
			getObjByJsonFile('.//data/dd.json').then(x=>{
				//读取数据
				document.getElementById('app').innerText=x.a
			})
		</script>
	</body>
</html>
